<?php 
        //获得总条数
        global $db;
        $sql = "select * from nettteach_note where userid = '".$_SESSION['sid']."' order by time desc";
        $result = $db -> query($sql);
        $recordcount = $db -> num_rows($result);

        //pagebar
        @$page=$_GET['p'];							//接收页码
        if ($page==null){$page=1;}
        $pagesize=15;								//每页显示数
        $pagecount=ceil($recordcount/$pagesize);	//计算总页
        if ($page>$pagecount){$page=$pagecount;}
        if ($page<1){$page=1;}
        //pagebarend
        $sql = $sql." limit ".($page-1)*($pagesize).",$pagesize";
        $result=$db->query($sql);	//limit意思是从多少条开始查找多少条
?>
		<div id="sidebar_center" style="width: 735px;height: 100%">
            <dl class="box1" style="height: 100%;width:735px;margin-top: 0;">
                <dt>
					<ul id="nav-table">
						<a class=" news_nav article_golink " href="#">记事本</a>
					</ul>					
				</dt>
            </dl>
		<table border="0" cellspacing="3" cellpadding="3" width="100%" class="breadcrumb" align="center">
                  <tr class="tabletr1" style="font-size:14px;font-weight:bold">
                    <td width="10%" height="30" align="center" valign="middle">序号</td>
                    <td width="60%" align="center" valign="middle">记事本内容</td>
                    <td width="30%" align="center" valign="middle">记录时间</td>
                  </tr>
				  <?php
				  if ($recordcount == 0)
				  {
				  ?>
				      <tr class="tabletr2">
                          <td height="30" align="left" valign="middle"></td>
                          <td height="30" valign="middle" style="padding-left:30px; font-weight:bold;">暂无记录！</td>
                          <td height="30" align="center" valign="middle"></td>
                          <td height="30" align="center" valign="middle"></td>
                          <td height="30" align="center" valign="middle"></td>
					  </tr>
				  <?php
				  }
				  else
				  {
				      $i = ($page-1)*($pagesize);
				      while ($row=$db->fetch_array($result)){
					      $i = $i + 1;
				  ?>
                      <tr>
                        <td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
                     </tr>
                      <tr class="tabletr2" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'" >
                        <td height="30" align="center" valign="middle"><?php echo ($i);?></td>
                        <td align="center" valign="middle"><a class="lj" href="?do=note&id=<?php echo ($row['id']);?>" title="点击查看详情"><?php echo mb_substr($row['content'],0,30,'utf-8');?></a></td>
                        <td align="center" valign="middle"><?php echo date('Y-m-d H:i:s',($row['time']));?></td>
                      </tr>
				  <?php
				      }
				  }
				  ?>
                </table>
			
	<div style="width:100%; text-align:center; line-height:30px;"> 
				<?php
/*分页示例:

pager(传入URL , 数据总数 , 开始条数 , 每页数目)
*/
echo(pager('?do=notelist&p={page}',$recordcount,($page-1)*($pagesize),$pagesize));		
?>
</div>
		</div>

